package com.kevin.springcloud.controller;

import com.kevin.springcloud.pojo.Dept;
import com.kevin.springcloud.service.DeptClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

import java.util.List;

@RestController
@RequestMapping("/consumer")
public class DeptConsumerController {

    @Autowired
    private DeptClientService deptClientService;

    @RequestMapping("/dept/get/{id}")
    public Dept get(@PathVariable(value = "id") Long id) {

        return deptClientService.queryById(id);
    }

    @PostMapping("/dept/add")
    public boolean addDept(Dept dept) {

        return deptClientService.addDept(dept);
    }


    @GetMapping("/dept/getAll")
    public List<Dept> getAll() {

        return deptClientService.queryAll();
    }


}
